# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from ..MessageAnalysis import*

class JT_8804:
    result = []
    s=""
    def LogicAisle(self, protocolStr, header):
        count = 0
        s=protocolStr[count:count + 2]
        header.append("录音命令:"+ s )
        if s=="00":
            header.append("停止录音" +"\n")
            count = count + 2
        elif s=="01":
            header.append("开始录音" + "\n")
            count = count + 2
        s = protocolStr[count:count + 4]
        header.append("录音时间：")
        if s=="00":
            header.append(s +"一直录音" + "\n")
            count = count + 4
        else:
            s = int(s, 16)
            header.append(str(s) + "\n")
            count = count + 4
        s = protocolStr[count:count + 2]
        header.append("保存标志：")
        if s == "00":
            header.append(s + "时实上传" + "\n")
        elif s == "01":
            header.append(s + "保存" + "\n")
        count = count + 2
        s = protocolStr[count:count + 2]
        header.append("音频采样率：")
        if s == "00":
            header.append( "8k" + "\n")
        elif s == "01":
            header.append( "11k" + "\n")
        elif s == "02":
            header.append( "23k" + "\n")
        elif s == "03":
            header.append( "32k" + "\n")
        count = count + 2
        

        self.result = header
